#******************************************************************
#
# Copyright 2015 Samsung Electronics All Rights Reserved.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Import('env')

enrollee_env = env.Clone()
transport = enrollee_env.get('TARGET_TRANSPORT')

######################################################################
# Build flags
######################################################################
enrollee_env.PrependUnique(CPPPATH = [
        '../../../../../resource/oc_logger/include',
        '../../../../../resource/csdk/logger/include',
        '../../../../../resource/csdk/stack/include',
	'../../../../../extlibs/cjson',
	'../../../sdk/common',
	'../../../sdk/enrollee/arduino/wifi',
	'../../../sdk/enrollee/api',
	'../../../sdk/enrollee/inc',
	'../../../sdk/enrollee/src'
	])
enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI'])
	
enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])

enrollee_env.PrependUnique(LIBS = ['octbstack','ocsrm','connectivity_abstraction','coap', 'ESSDKLibrary'])
enrollee = enrollee_env.Program('enrollee', 'enrollee_wifi.cpp')
env.CreateBin('enrollee')

i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee)

Alias('enrollee', i_enrollee)
env.AppendTarget('enrollee')

if(enrollee_env['UPLOAD'] == True):
	from sys import platform as _platform
	if _platform == "linux" or _platform == "linux2":
		enrollee_env.Upload(env.get('BUILD_DIR') + '/service/easy-setup/sampleapp/enrollee/arduino/enrollee.hex')
	else:
		print 'Please use appropriate install method for your developing machine. Linux is the only supported platform right now.'
